from fractions import Fraction


def decimal_to_fraction(decimal):
    fraction = Fraction(decimal).limit_denominator()
    return fraction


decimal = float(input("请输入一个小数："))
fraction = decimal_to_fraction(decimal)
print("分数形式为：", fraction)

